#include "Input.h"

#include <string>

#include <cv.h>
#include <highgui.h>//for cvCapture



Input::Input(bool useFile, std::string videoFileName)
{
	int camIndex = 0;
	
	if(useFile){
		this->capture = cvCaptureFromFile(videoFileName.c_str());
	} else {
		this->capture = cvCaptureFromCAM(camIndex);
	}
}

Input::~Input()
{
}

IplImage* Input::getNextFrame(){
	
	/* OpenCV takes care of allocation AND deallocation of images obtained via
	 * a cvCapture (like by cvQueryFrame). This means that images returned here
	 * MUST NOT be released anywhere in the code. */
	return cvQueryFrame(this->capture);
}

